package com.hm;

import com.sankuai.inf.leaf.plugin.annotation.EnableLeafServer;
import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RestController;

/**
* @Description: TODO
* @param
* @return 
* @throws
* @author Coder编程
* @date 2021/6/16 15:58
*/
@EnableLeafServer
@RestController
@SpringBootApplication
public class ShortUrlApplication {

	public static void main(String[] args) {
		SpringApplication.run(ShortUrlApplication.class, args);
	}
	//添加redisson的bean
	@Bean
	public Redisson redisson(){
		Config config = new Config();
		//此示例是单库的，可以是主从、sentinel、集群等模式
		config.useSingleServer().setAddress("redis://localhost:6379");
		return (Redisson)Redisson.create(config);
	}
}
